package com.example.consumer.controller;

import cn.dev33.satoken.stp.StpUtil;
import com.example.demo.dubbo.api.DemoService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 业务聚合
 *
 * @version [V2.0]
 * @package com.example.consumer.controller;
 * @description:[用一句话描述该文件做什么]
 * @author: [zhuben]
 * @date: [2024-01-18 14:37]
 * @copyright: 2024 echovin.com
 */

@RestController
public class IndexCotroller {
    @Resource
    private DemoService demoService;
    @GetMapping("test")
    public ResponseEntity<?> test(@RequestParam String name){
        String sayHello = demoService.sayHello(name);
        return ResponseEntity.ok(sayHello);
    }

    @GetMapping("helloword")
    public ResponseEntity<?> helloword(@RequestParam String name){
        String sayHello = demoService.helloWorld(name);
        return ResponseEntity.ok(sayHello);
    }

    @GetMapping("index")
    public ResponseEntity<?> index(){
        return ResponseEntity.ok(StpUtil.getTokenInfo());
    }
}
